package com.productserver.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.productserver.pojo.Product;
import com.productserver.service.Feign;
import com.productserver.service.ProductService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wjn.
 * @Date 2020/11/13 - 16:36.
 */
@RestController
public class ProductController {
    @Resource
    private ProductService productService;
    @Resource
    private Feign feign;

    @RequestMapping("getAll")
    @ResponseBody
    public Object getAllProductA(){
        List<Product> listPro = productService.getAllProduct();
        return listPro;
    }
    @RequestMapping("getAllABC")
    @ResponseBody
    @HystrixCommand(fallbackMethod = "getMassage")//可删除
    public String getBug(){
        return feign.getAllBug();
    }
    //可删除
    public String getMassage(){
        return "sorry";
    }

}
